package mulMan.domain;

import java.util.Observable;
import java.util.Observer;

public class AudioFileFactory implements Observer{
	
	private PlaylistModel playlist;
	private AudioFileModel audioFile;
	
	public AudioFileFactory(PlaylistModel playlist) {
		this.playlist = playlist;
	}
	
	public AudioFileModel addAudioFileToPlaylist() {
		audioFile = new AudioFileModel();
		audioFile.addObserver(this);
		return audioFile;
	}

	public void update(Observable o, Object arg) {

		if (arg == "id") {
			playlist.addAudioFileToPlaylist(audioFile);
			audioFile.deleteObserver(this);
		}
	}
}
